Navigation: Up, Table of Contents, Bibliography, Index, Title Page

Robust filtered predicates ( CGAL_Filtered_exact<CT,ET>)

The class CGAL_Filtered_exact<CT,ET> is a wrapper type for the number type CT, with the difference that all predicates are specialized such that they are guaranteed to be exact. Speed is achieved via a filtering scheme using interval arithmetic (see Section reference arrow). Here are the necessary requirements:

Example

You might use at the beginning of your program a typedef as follows:

    #include<CGAL/Arithmetic_filter.h>
    #include<CGAL/leda_real.h>
    #include<CGAL/double.h>
    typedef CGAL_Filtered_exact<double, leda_real> NT;

Or if you are sure that the predicates involved do not use divisions nor square roots:

    #include<CGAL/Arithmetic_filter.h>
    #include<CGAL/Gmpz.h>
    #include<CGAL/int.h>
    typedef CGAL_Filtered_exact<int, CGAL_Gmpz> NT;

And if you know that the double variables contain integer values, you can use:

    #include<CGAL/Arithmetic_filter.h>
    #include<CGAL/Gmpz.h>
    #include<CGAL/double.h>
    typedef CGAL_Filtered_exact<double, CGAL_Gmpz> NT;

Implementation

The template definition of the low level predicates of CGAL are overloaded for the type CGAL_Filtered_exact<CT,ET>. It is a partial specialisation, which implies that this is not supported by the compilers that do not support this C++ feature (SunPro 4.2, MipsPro 7.2).

For each predicate file, the overloaded code is generated automatically by a PERL script ( examples/Interval_arithmetic/filtered_predicate_converter) that you can use for your own predicates (see examples/Interval_arithmetic/README). This script parses the template declaration of the functions and generates the overloaded code the following way:

Example

The low level template predicates of CGAL are in files named CGAL/predicates_on_ftC2.h (resp. ftC3, rtH2, rtH3), the script is used to produce the files CGAL/Arithmetic_filter/predicates_on_ftC2.h (resp. ftC3, rtH2, rtH3).


Next: Class declaration of CGAL_Gmpz
Navigation: Up, Table of Contents, Bibliography, Index, Title Page
The CGAL Project. 22 January 1999.